package ynu.lcy.entity;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import ynu.lcy.elememicroservicecommon.entity.BaseEntity;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import java.util.List;

/**
 * 点餐类型实体
 * */
@Entity
@Setter
@Getter
@NoArgsConstructor
@JsonIgnoreProperties(value = {"hibernateLazyInitializer", "handler", "fieldHandler"})
public class OrderType extends BaseEntity {
    /*
    * 类型标签
    * */
    private  String label;

    /*
    * 类型图片
    * */
    private  String image;

    /*
    * 所属商家
    * */
    @OneToMany(mappedBy = "orderType",
            fetch = FetchType.EAGER,
            orphanRemoval = true,
            cascade = CascadeType.ALL)
    @JsonIgnoreProperties("orderType")
    private List<BusinessOrderType> businessOrderTypes;

}
